define(['app'],function(app){return {module: function($scope, $http, eventBusService, httpService, params, configService) {
        $scope.form = {};
        $scope.menu_name = "学生管理";
        $scope.form.fk_class = params.fk_class;
        $scope.form.fk_major = params.fk_major;

        //根据专业id，查询专业
        /*$scope.findMajor = function(){
            httpService.postpage(app.urls.major_selectById, {id:$scope.form.fk_major}, function(data){
                if("0000" === data.code){
                    let major = data.data;
                    console.log(major);
                }else{
                    alert(data.msg);
                }
            });
        }
        $scope.findMajor();*/

        //查询
        $scope.find = function(){
            httpService.postpage(app.urls.findRecruitStudentListURL, $scope.form, function(data){
                if("0000" === data.code){
                    $scope.rows = data.data;
                }else{
                    alert(data.msg);
                }
            });
        }
        $scope.find();

        //按钮点击事件-条件查询
        $scope.select = function(){
            $scope.page.current = 1;
            $scope.find();
        }

        $scope.save = function() {
            var values = [];
            $('#'+$scope.controllerName+' input[name="dataPk"]:checked').each(function(){
                values.push(JSON.parse($(this).val()));
            });

            $scope.form.recruitStudentArrayStr = JSON.stringify(values);
            httpService.post(app.urls.divisionClassAddStudentURL, $scope.form,function(data){
                if("0000" === data.code){
                    eventBusService.publish("content.page.reload", null);
                    eventBusService.publish("modal.page.close",{});
                }else{
                    alert(data.msg);
                }
            });
        }

}}});
